import { defineStore } from 'pinia';

export const useResizeStore = defineStore({
    id: 'resize',

    state: () => ({
        windowHeight: {
            init: window.innerHeight,
            current: window.innerHeight,
        },
        isKeyboardStatus: false,
    }),
    getters: {
        isKeyboardOpen() {
            return this.windowHeight.init !== this.windowHeight.current;
        },
    },

    actions: {
        handleDeviceHeightChange(val) {
            this.windowHeight.current = val.target.innerHeight;
            this.isKeyboardStatus = Boolean(this.windowHeight.init !== this.windowHeight.current)
        },
    },
});
